package com.system.runtai.controller;


import com.system.common.result.Result;
import com.system.runtai.entity.Community;
import com.system.runtai.entity.Demand;
import com.system.runtai.service.DemandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * <p>
 * 需求专区 前端控制器
 * </p>
 *
 * @author runtai
 * @since 2024-03-29
 */
@Api(tags = "需求专区")
@RestController
@RequestMapping("/runtai/demand")
public class DemandController {

    @Autowired
    private DemandService demandService;


    @ApiOperation(value = "需求社区LOGO修改")
    @PostMapping("/updateDemand")
    public Result<Demand> updateDemand(@RequestBody Demand community){
        community.setUpdateTime(LocalDateTime.now());
        boolean b = demandService.updateById(community);

        if (b){
            return Result.ok(community).message("修改成功");
        }
        return Result.fail(community).message("修改失败");
    }

}

